<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/include/header.jsp"%>
<%-- 커뮤니티 가입/변경/탈퇴 페이지 --%>
<div width="980px">
<table border="0" cellpadding="0" cellspacing="0" width="980px">
	<tr>
		<td style="vertical-align: top;width: 180px;background-color: #fdb73a;">
			<%@ include file="../common/include/leftmenu.jsp"%>
		</td>
		<td style="width: 800px; height: 500px;">
<div style="width: 800px;">
	<table style="width: 800px;text-align: center;" cellpadding="0" cellspacing="0">
		<tr>
			<html:form action="/communityjoin">
			<td style="width: 600px;text-align: center;">
				<div style="width: 500px;height: 40px;border: 0;">
					<img src="<%=imagePath %>comm_join_04.jpg" border="0"/>
				</div>
				<html:hidden property="coname"/>
				<div style="width: 298px;height: 100px;border: 1px solid #fdb32a;padding-top: 10px;">
					<img src="<%=imagePath %>comm_join_06.jpg" border="0"/>
					<html:text property="mcnick" style="width: 130px;height: 16px;font-size: 8pt;"></html:text>
					<img src="<%=imagePath %>comm_join_07.jpg" border="0"  onclick="nickcheck('<bean:write name="mcForm" property="cono"/>')" onmouseover="javascript:this.style.cursor='hand';"/>
					<hr style="width: 95%;" size="1"/><br/>
					<img src="<%=imagePath %>comm_join_08.jpg"  onclick="receive('<bean:write name="mcForm" property="nickcheck"/>')" style="border: 1px solid #fdb32a;padding-left: 10px;padding-right: 10px;" onmouseover="javascript:this.style.cursor='hand';"/>

				<logic:notEqual value="0" name="mcForm" property="lvno">
					<logic:notEqual value="7" name="mcForm" property="lvno">
						<img src="<%=imagePath %>comm_join_09.jpg"  onclick="out('<bean:write name="mcForm" property="cono"/>')" style="border: 1px solid #fdb32a;padding-left: 10px;padding-right: 10px;" onmouseover="javascript:this.style.cursor='hand';"/>
					</logic:notEqual>
					<logic:equal value="7" name="mcForm" property="lvno">
						<br/>관리자는 탈퇴 할수 없습니다.-.-;;
					</logic:equal>
				</logic:notEqual>
				</div>

				<input type="hidden" name="method" value="receiveData"/>
				<input type="hidden" name="cono" value="<bean:write name="mcForm" property="cono"/>"/>
				<html:hidden property="lvno"/>
				<logic:equal value="false" name="mcForm" property="nickcheck">
					<script type="text/javascript">
						alert('중복되었습니다.');
					</script>
				</logic:equal>
				<logic:equal value="true" name="mcForm" property="nickcheck">
					<script type="text/javascript">
						alert('사용할 수 있습니다.');
					</script>
				</logic:equal>
			</td>
			</html:form>			
			
<!-- 우측 이미지 (200x500) -->
			<td style="width: 200px;height: 500px;"><img src="<%=imagePath %>comm_join_02.jpg" border="0"></td>
		</tr>
	</table>

</div>
		</td>
	</tr>
</table>
<script type="text/javascript">
<!--
	function getBoard(u,b){
		var url = '<%=path%>/board/'+u;
		url = url + escape(encodeURIComponent(b));
		location.href=url; 
	}
	
	//커뮤니티 닉네임 체크
	function nickcheck(cono){
		var nick = document.mcForm.mcnick.value;
		var renick = nick.replace(/\s/g,'');
		if(renick != ''){
			nick = decodeURIComponent(nick);
			location.href='<%=path%>/community/communityjoin.do?method=nickCheck&cono='+cono+'&mcnick='+escape(encodeURIComponent(nick));
		}else{
			alert('닉네임을 입력해 주세요.');
		}
	}
	
	//닉네임 체크 여부 확인
	function receive(isCheck){
		var nick = document.mcForm.mcnick.value;
		var renick = nick.replace(/\s/g,'');
		if(renick != ''){
			if(isCheck == 'first'){
				alert('닉네임 중복확인해주세요');
			}else if(isCheck == 'false'){
				alert('닉네임 중복되었습니다.');
			}else{
				document.mcForm.submit();
			}
		}else{
			alert('닉네임을 입력해 주세요');
		}
	}
	
	function out(cono){
		var result = confirm("정말로 탈퇴 하시겠습니까?");
		if(result){
			location.href='<%=path%>/community/communityjoin.do?method=delData&cono='+cono;
		}
	}
	
	
//-->
</script>
</div>
<%@ include file="../common/include/footer.jsp" %>